+2008-11-08 Øyvind Kolås <pippin@gimp.org>
+
+ * extensions/gegl-fixups.c: (conv_rgbAF_lrgba8): use the lookup tables
+ to speed up the conversion 8still error of 0.002677 though).
+
2008-11-06 Øyvind Kolås <pippin@gimp.org>
* extensions/gegl-fixups.c: (conv_rgbAF_rgbaF),
}
+
static long
conv_rgbAF_lrgba8 (unsigned char *srcc,
unsigned char *dstc,
while (n--)
{
float alpha = src[3];
- float recip = (1.0/alpha)*255.0;
+ float recip = (1.0/alpha);
if (alpha < 0.00001)
- recip = 0.0;
- dst[0] = (src[0] * recip);
- dst[1] = (src[1] * recip);
- dst[2] = (src[2] * recip);
- dst[3] = alpha*255.0;
+ {
+ dst[0] = dst[1] = dst[2] = dst[3] = 0;
+ }
+ else
+ {
+ dst[0] = table_F_8[gggl_float_to_index16 (src[0] * recip)];
+ dst[1] = table_F_8[gggl_float_to_index16 (src[1] * recip)];
+ dst[2] = table_F_8[gggl_float_to_index16 (src[2] * recip)];
+ dst[3] = table_F_8[gggl_float_to_index16 (alpha)];
+ }
src += 4;
dst += 4;
}